/**
 * @author zhaozhenjiang
 * 创建数据库软件安装响应文件
 * */

package com.auto.oracle;

final class createDbSql {
	private createFile dbsql = null;
	private createParams para = null;
	public createDbSql(String base_path,String resp_name,createParams para){
		dbsql = new createFile(base_path, resp_name);
		this.para = para;
	}
	
	public void createFile(){
		dbsql.init();
		dbsql.append("CREATE DATABASE \"" + para.getInstanceName() + "\"");
		dbsql.append("USER SYS IDENTIFIED BY \"" + para.getDatabasePwd() + "\"");
		dbsql.append("USER SYSTEM IDENTIFIED BY \"" + para.getDatabasePwd() + "\"");
		dbsql.append("LOGFILE GROUP 1 ('" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/redo01.log') SIZE 100M BLOCKSIZE 512,");
		dbsql.append("GROUP 2 ('" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/redo02.log') SIZE 100M BLOCKSIZE 512,");
		dbsql.append("GROUP 3 ('" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/redo03.log') SIZE 100M BLOCKSIZE 512");
		dbsql.append("MAXLOGFILES 50");
		dbsql.append("MAXLOGMEMBERS 5");
		dbsql.append("MAXLOGHISTORY 1");
		dbsql.append("MAXDATAFILES 100");
		dbsql.append("CHARACTER SET " + para.getCharsetType());
		dbsql.append("NATIONAL CHARACTER SET " + para.getNationalType());
		dbsql.append("EXTENT MANAGEMENT LOCAL");
		dbsql.append("DATAFILE '" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/system01.dbf' SIZE 325M REUSE");
		dbsql.append("SYSAUX DATAFILE '" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/sysaux01.dbf' SIZE 325M REUSE");
		dbsql.append("DEFAULT TABLESPACE users");
		dbsql.append("DATAFILE '" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/users01.dbf'");
		dbsql.append("SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED");
		dbsql.append("DEFAULT TEMPORARY TABLESPACE temp");
		dbsql.append("TEMPFILE '" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/temp01.dbf'");
		dbsql.append("SIZE 200M REUSE");
		dbsql.append("UNDO TABLESPACE undotbs1");
		dbsql.append("DATAFILE '" + para.getOraclePath() + "/app/oracle/oradata/" + para.getInstanceName() + "/undotbs01.dbf'");
		dbsql.append("SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;");
		dbsql.append("@?/rdbms/admin/catalog.sql");
		dbsql.append("@?/rdbms/admin/catproc.sql");
		dbsql.append("conn system/\"" + para.getDatabasePwd() + "\"");
		dbsql.append("@?/sqlplus/admin/pupbld.sql");
		dbsql.close();
		dbsql = null;
	}	

	@SuppressWarnings("unused")
	private class Decompile{
		
	}
}
